<template>
	<view class="content">
		<view class="match-top-box">
			<view class="match-title">尊敬的律师：</view>
			<view class="match-txt">您好！请先与委托人联系一下，避免委托人长时间等待，影响服务感受。感谢您的信任与支持！祝您圆满成功！</view>
			<template v-if="info.order.price_type == '自费'">
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right green">您接单后15分钟内，如委托人没有更换律师的，平台将自动在“办公”页面，为您和委托人创建本订单的项目和群聊，方便您和委托人沟通。</view>
				</view>
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right green">
            办案过程中，如发现案件管辖地在您的执业区域以外，请先跟委托人说明情况并征得委托人同意后，点击下面“换个律师”按钮，帮助委托人更换律师。
          </view>
				</view>
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right green">请及时审查案件的诉讼时效、反诉期、管辖权异议期、举证期、保证期间、抵押期间等，避免相关法定期间在您接案后过期，导致赔偿。</view>
				</view>
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right green">如需查询异地被告的身份证明，请下载“无讼”app，在“律师协作-异地查档”里办理。</view>
				</view>
			</template>
			<template v-else>
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right red">请先与委托人签署委托代理合同</view>
				</view>
				<view class="match-image-txt" v-if="info.order.pro_name != '问一下'">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/warning.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right red">您接单后15分钟内，如委托人没有更换律师的，平台将自动在“办公”页面，为您和委托人创建本订单的项目和群聊，方便您和委托人沟通。</view>
				</view>
			</template>
			<template v-if="info.order.pro_name == '私人律师'">
				<view class="match-image-txt">
					<view class="txt-left">
						<view class="image-wrapper"><image src="@/static/img/time-green.png" mode="aspectFit"></image></view>
					</view>
					<view class="txt-right">
						还可咨询
						<text class="red">{{ info.order.day }}天</text>
					</view>
				</view>
			</template>
			<view class="service-list">
				<button class="service-item active" @click="$refs.telephoneClient.$refs.popupTel.open()">联系委托人</button>
				<template v-if="info.order.pro_name != '问一下'">
					<!-- <button class="service-item active" @click="navToProDetail(info.order.project_id)">项目详情</button> -->
					<!-- <button class="service-item active" v-if="info.order.usergroupid" @click="navToChat(info.order.usergroupid)">办理详情</button> -->
				</template>
				<button class="service-item active" @click="$refs.popupOneWantPay.open()" v-if="info.order.pro_name != '问一下'">我要收款</button>
				<button class="service-item active" :disabled="isLawyerServiceOk || isClientServiceOk || disableServiceOk" @click="$refs.popupServiceOk.open()">服务完成</button>
				<button class="service-item active" :disabled="isClientRemoveEntrust || isLawyerRemoveEntrust || disableRemoveEntrust" @click="removeEntrust">解除委托</button>

				<button class="service-item active" :disabled="info.order.is_over != 1 || info.order.status==21||info.order.status==22||isLawyerServiceOk || isClientServiceOk || disableServiceOk || isClientRemoveEntrust || isLawyerRemoveEntrust || disableRemoveEntrust" @click="$refs.popupCheckLaw.open()">换个律师</button>
				<template v-if="info.order.status==22">
					<view class="service-list" style="padding-top: 0rpx;">
					<button class="service-item active flex1" @click="$refs.popupCancelLaw.open()">取消更换律师</button>
					<button class="service-item active flex1" style="margin-right: 0;" @click="$refs.telephoneClient.$refs.popupTel.open()">催促委托人确认更换</button>
					</view>
				</template>
				<template v-if="info.order.status==21">
					<view class="service-list" style="padding-top: 0rpx;">
					<button class="service-item active flex1" @click="$refs.popupBackLaw.open()">退回更换律师申请</button>
					<button class="service-item active flex1" style="margin-right: 0;" @click="$refs.popupAgreeLaw.open()">确认更换律师</button>
					</view>
				</template>
				<button class="service-item active" v-if="isLawyerServiceOk" style="width: 100%; margin-right: 0;" @click="$refs.telephoneClient.$refs.popupTel.open()">
					催促委托人确认完成
					<uni-countdown
						:show-day="true"
            :day="remainTime.day"
            :hour="remainTime.hour"
            :minute="remainTime.minute"
            :second="remainTime.second"
						color="#f00"
						splitorColor="#f00"
						backgroundColor="#FFC801"
						@timeup="timeup"
					></uni-countdown>
				</button>
				<button class="service-item active" v-if="isLawyerRemoveEntrust" style="width: 100%; margin-right: 0;" @click="$refs.telephoneClient.$refs.popupTel.open()">
					催促委托人确认解除
				</button>
				<button class="service-item active" v-if="isLawyerServiceOk || isLawyerRemoveEntrust" style="width: 100%; margin-right: 0;" @click="$refs.popupCancelServiceApply.open()">
					取消申请
				</button>
			</view>
			<template v-if="isClientRemoveEntrust">
				<view class="service-list">
					<button class="service-item active flex1" @click="$refs.popupSureRemoveEntrust.open()">确认解除委托</button>
					<button class="service-item active flex1" style="margin-right: 0;" @click="$refs.popupNoSureRemoveEntrust.open()">退回申请</button>
				</view>
			</template>
			<template v-if="isClientServiceOk">
				<view class="service-list">
					<button class="service-item active flex1" @click="$refs.popupSureServiceOk.open()">确认服务完成</button>
					<button class="service-item active flex1" style="margin-right: 0;" @click="$refs.popupNoSureServiceOk.open()">退回申请</button>
				</view>
			</template>
		</view>
		<!-- 待收信息-->
		<order-wait-receive-zifei v-if="Object.keys(info.order).length > 0" :info="info" @init="init" @popupShow="popupShow"></order-wait-receive-zifei>
		<!-- 收款详情 -->
		<order-client-detail v-if="Object.keys(info.order.pay_text).length > 0 || Object.keys(info.order.jie_pay).length > 0" :detailLIst="info.order.pay_text" title="收款详情" :info="info"  @popupShow="popupShow"></order-client-detail>
		<!--滞纳金-->
	<!-- 	<order-detail-zhina v-if="Object.keys(info.order).length > 0" :info="info" @init="init"></order-detail-zhina> -->
		<!-- 增加服务详情 -->
		<order-common-detail v-if="Object.keys(info.order).length > 0" :detailLIst="info.order.server_pay" title="增加服务" :info="info"></order-common-detail>
		<!-- 续费详情 -->
		<order-common-detail v-if="Object.keys(info.order).length > 0" :detailLIst="info.order.xu_pay" title="续费详情" :info="info"></order-common-detail>
		<!-- 发票列表组件-->
		<order-invoice-invest v-if="Object.keys(info.order).length > 0" :info="info" @init="init"></order-invoice-invest>
		<!-- 产品说明组件 -->
		<order-unfold-product-text title="产品说明" :isBold="true" :price_type='info.order.price_type'></order-unfold-product-text>
		<!-- 案件主体信息 -->
		<order-case :info="info" :key="new Date().getTime() + 'case'" v-if="info.order.pro_name == '打官司'"></order-case>
		<!-- 订单详情  -->
		<order-detail ref="orderAllDetail" :info="info.order"></order-detail>
		<!-- 解除委托-未付款弹出层 -->
		<uni-popup ref="popupRemoveEntrust" type="dialog">
			<uni-popup-dialog type="info" title="" okTxt="我知道了" cancleTxt="" content="" :before-close="true" @confirm="closePop('popupRemoveEntrust')">
				<view class="warm-tip-box">
					<view class="warm-tip-item">为保障您及您好友推荐本平台应得的奖励，请按照以下流程解除和退款：</view>
					<view class="warm-tip-item">
						<view class="item-left">1</view>
						<view class="item-right">在本平台“办公”→“信息”→本订单“委托人协作团队”群聊里，与委托人确定解除事宜，保留聊天记录；</view>
					</view>
					<view class="warm-tip-item">
						<view class="item-left">2</view>
						<view class="item-right">在“待收信息”里，收齐剩余律师费用；</view>
					</view>
					<view class="warm-tip-item">
						<view class="item-left">3</view>
						<view class="item-right">再次点击“解除委托”按钮，发起解除；</view>
					</view>
					<view class="warm-tip-item">
						<view class="item-left">4</view>
						<view class="item-right">联系委托人，确认解除委托；</view>
					</view>
					<view class="warm-tip-item">
						<view class="item-left">5</view>
						<view class="item-right">委托人确认后，您将进入“服务解除”页面。如需退款的，可在该页面点击“退款”按钮办理。</view>
					</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
		<!-- 解除委托 弹出层-->
		<uni-popup ref="popupRemoveEntrustReason" type="dialog">
			<uni-popup-dialog-reason
				type="info"
				title=""
				okTxt="确认"
				cancleTxt="取消"
				:showClose="false"
				:before-close="true"
				@confirm="
					confirmReason();
				"
				@close="closePop('popupRemoveEntrustReason')"
			>
				<view class="return-reason-box">
					<view class="return-tip">解除原因
					<text style="color:red">*</text></view>
					<textarea class="textarea-border textarea-height" placeholder="请输入" placeholder-class="placeholder" v-model="reason" />
				</view>

				<view class="entrust-tip">我已与委托人确认解除委托</view>
			</uni-popup-dialog-reason>
		</uni-popup>
		<!-- 确认解除委托弹出层 -->
		<uni-popup ref="popupSureRemoveEntrust" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
        :before-close="true"
				@confirm="sureRemoveEntrust(1, 'popupSureRemoveEntrust')"
				@close="closePop('popupSureRemoveEntrust')"
			>
				<view class="dialog-tip">解除委托原因：</view>
				<view class="dialog-tip">{{ info.order.lawyer_remove }}</view>
				<view class="dialog-tip-line">我确认解除委托</view>
			</uni-popup-dialog>
		</uni-popup>
		<!-- 不确认解除委托弹出层 -->
		<uni-popup ref="popupNoSureRemoveEntrust" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				:before-close="true"
				@confirm="sureRemoveEntrust(2, 'popupNoSureRemoveEntrust')"
				@close="closePop('popupNoSureRemoveEntrust')"
			>
				<view class="dialog-tip">解除原因：</view>
				<view class="dialog-tip">{{ info.order.lawyer_remove }}</view>
				<view class="dialog-tip-line">确认退回申请</view>
			</uni-popup-dialog>
		</uni-popup>
		<!-- 服务完成弹出层 -->
		<uni-popup ref="popupServiceOk" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				content="我已与委托人确认服务完成"
				:before-close="true"
				@confirm="confirmServiceOk"
				@close="closePop('popupServiceOk')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 确认服务完成弹出层 -->
		<uni-popup ref="popupSureServiceOk" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				content="我确认服务已经完成"
				:before-close="true"
				@confirm="sureServiceOk(1, 'popupSureServiceOk')"
				@close="closePop('popupSureServiceOk')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 不确认服务完成弹出层 -->
		<uni-popup ref="popupNoSureServiceOk" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				content="确认退回申请"
				:before-close="true"
				@confirm="sureServiceOk(2, 'popupNoSureServiceOk')"
				@close="closePop('popupNoSureServiceOk')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 第一部分我要收款弹出层 -->
		<uni-popup ref="popupOneWantPay" type="dialog">
			<uni-popup-dialog
				type="info"
				title="我要收款"
				okTxt="确认"
				cancleTxt="取消"
				:before-close="true"
				@confirm="confirmOneWantPay()"
				@close="closePop('popupOneWantPay')"
			>
				<view class="od-box" style="width: 100%; padding: 0;">
					<view class="od-item marginbottom10"  style="align-items:center;">
						<view class="item-tip">付款人</view>
						<view class="item-right"><view class="item-txt">委托人</view></view>
					</view>
					<view class="od-item marginbottom10">
						<view class="item-tip require">请款金额</view>
						<view class="item-right">
							<view class="item-txt"><input type="number" class="ipt-border" placeholder="请输入" placeholder-class="placeholder" v-model="onePrice" /></view>
						</view>
					</view>
					<view class="od-item marginbottom10">
						<view class="item-tip require">请款事由</view>
						<view class="item-right">
							<view class="item-txt"><textarea auto-height="true" class="textarea-border" placeholder="请输入" placeholder-class="placeholder" v-model="oneReason" /></view>
						</view>
					</view>
				</view>
				<view class="dialog-tip-line" style="padding-top: 25rpx; padding-bottom: 0;">我已与委托人确认付款事宜</view>
			</uni-popup-dialog>
		</uni-popup>
		<!-- 打电话组件 -->
		<order-telephone name="委托人" :phoneNumber="info.order.user_mobile" ref="telephoneClient" v-if="info.order.user_mobile"></order-telephone>
		<order-telephone name="律师" :phoneNumber="info.order.lawyer_mobile" ref="telephoneLawyer" v-if="info.order.lawyer_mobile"></order-telephone>
		<order-telephone name="投资人" :phoneNumber="info.order.investor_mobile" ref="telephoneInvestor" v-if="info.order.investor_mobile"></order-telephone>
		<!-- 取消申请弹出层 -->
		<uni-popup ref="popupCancelServiceApply" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				:content="info.order.status == 4 ? '取消服务完成申请' : '取消服务解除申请'"
				:before-close="true"
				@confirm="
					closePop('popupCancelServiceApply');
					cancleApplyService();
				"
				@close="closePop('popupCancelServiceApply')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 全局通用组件 -->
		<law-common ref="lawCommon"></law-common>
		<!-- 律师请款 -->
		<lawyer-qing ref="lawyerQing" :item="current_item"></lawyer-qing>
		<!--    律师请款2-->
		<lawyer-qing2 ref="lawyerQing2" :item="current_item"></lawyer-qing2>
		<lawyer-qing3 ref="lawyerQing3" :item="current_item"></lawyer-qing3>
		<!-- 更换律师弹框 -->
		<uni-popup ref="popupCheckLaw">
			<view class="check-back">
				<view style="display: flex;align-items: center;justify-content: space-between;">
					<view class=""></view>
					<view class="check-title">更换律师</view>
					<view class="close-img" @click="$refs.popupCheckLaw.close()">
						<image src="@/static/img/close.png" mode="aspectFit" style="width: 100%;height: 100%;"></image>
					</view>
				</view>
				<view style="margin-top: 50rpx;margin-left: 40rpx;">
					<view class="check-title">更换理由<span style="color: red;">*</span></view>
					<view class="list-item" @click="cause(0)">
						<image src="../../../static/img/icon/radio.png" v-if="causeOne==false" style="width: 30rpx;height: 30rpx;"></image>
						<image src="../../../static/img/icon/radioed.png" v-else style="width: 30rpx;height: 30rpx;"></image>
						<view style="margin-left: 10rpx;">法院不予立案</view>
					</view>
					<view class="list-item" @click="cause(1)">
						<image src="../../../static/img/icon/radio.png" v-if="causeTwo==false" style="width: 30rpx;height: 30rpx;"></image>
						<image src="../../../static/img/icon/radioed.png" v-else style="width: 30rpx;height: 30rpx;"></image>
						<view style="margin-left: 10rpx;">案件移送异地审理</view>
					</view>
					<view class="list-item" style="align-items: flex-start" @click="cause(2)">
						<image src="../../../static/img/icon/radio.png" v-if="causeThree==false" style="width: 30rpx;height: 30rpx;margin-top: 6rpx;"></image>
						<image src="../../../static/img/icon/radioed.png" v-else style="width: 30rpx;height: 30rpx;margin-top: 6rpx;"></image>
						<view style="margin-left: 10rpx;display: flex;width: calc(100% - 40rpx);">
							<view class="">其他</view>
							<textarea auto-height placeholder="输入其他事由" v-model="causeThreeTxt" style="margin-left: 5rpx;border-bottom: 1rpx solid black;width: calc(100% - 70rpx);" />
						</view>
					</view>
				</view>
				<view style="text-align: center;margin-top: 50rpx;">我已与委托人协商好换个律师</view>
				<view v-if="causeValue" class="btn" @click="checkLaws">换个律师</view>
				<view v-else class="dis-btn">换个律师</view>

			</view>
		</uni-popup>
		<!-- 取消更换委托人弹框 -->
		<uni-popup ref="popupCancelLaw" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				title="确认取消更换"
				:showClose="true"
        :before-close="true"
				@confirm="
					closePop('popupCancelLaw');
					cancelLaws();
				"
				@close="closePop('popupCancelLaw')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 退回委托人更换律师弹框 -->
		<uni-popup ref="popupBackLaw" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				title="退回更换律师申请"
				:before-close="false"
				@confirm="
					closePop('popupBackLaw');
					lawBack();
				"
				@close="closePop('popupBackLaw')"
			>
			<view class="dialog-tip">更换律师原因：</view>
			<view class="dialog-tip">
				{{info.order.change_type==3?info.order.change_reason:info.order.change_type==2?'案件移送异地审理':'法院不予立案'}}
			</view>
			</uni-popup-dialog>
		</uni-popup>
		<!-- 同意委托人更换律师弹框 -->
		<uni-popup ref="popupAgreeLaw" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				title="确认更换律师"
				:before-close="true"
				@confirm="
					closePop('popupAgreeLaw');
					lawAgree();
				"
				@close="closePop('popupAgreeLaw')"
			>
			<view class="dialog-tip">更换律师原因：</view>
			<view class="dialog-tip">
				{{info.order.change_type==3?info.order.change_reason:info.order.change_type==2?'案件移送异地审理':'法院不予立案'}}
			</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
import { mixin } from '@/common/mixins/face_order_state.js';
export default {
	mixins: [mixin],
	data() {
		return {
			info: {
				order: {}
			},
			current_item:{},
			order_id: '',
			reason: '',
			onePrice: '', // 第一部分我要收款价格
			oneReason: '', // 第一部分我要收款原因
			remainTime: {} ,//剩余时间
			causeOne:false, //更换律师理由一
			causeTwo:false,//更换律师理由二
			causeThree:false ,//更换律师理由三
			causeThreeTxt:'',//更换律师理由三 文本内容
			causeValue:false
		};
	},
	onLoad(params) {
		if (params.order_id) {
			this.order_id = params.order_id;
			this.init();
		}
	},
	methods: {
		async init() {
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('index.orderDetail', formData);
			this.info = res.data;
			this.status = res.data.order.status;
			this.getOrderState(this.info);
			if (this.info.order.lawyer_finish) {
				this.remainTime = this.timeFn(this.info.order.lawyer_finish);
			}
		},
		popupShow(item) {
				console.log('X1',item)
				if (item.type == 8) {
					this.current_item = item
					this.$refs.returnCostTip.$refs.returnCost.open()
				} else if (item.type == 3 || item.type == 1) {
					/* this.current_item = item.popup
					this.$refs.settlement.$refs.settlement.open() */
					// this.current_item = item
					// this.$refs.investShouyi.$refs.investShou.open()
					this.current_item = item
					this.$refs.investShouyi.$refs.investShou.open()
				}else if (item.type == 6 ) {
					this.current_item = item
					this.$refs.lawyerQing3.$refs.lawyerApply3.open()
				} else if (item.type == 7 ) {
					this.current_item = item.popup
					this.$refs.lawyerApply.$refs.lawyerApply.open()
				} else if (item.type == 2) {
					// 退款弹窗
					this.current_item = item.popup
					this.$refs.lawyerTui.$refs.lawyerApply.open()
				} else if (item.shou_type == 2) {
					console.log('QQ');
					this.current_item = item
					this.$refs.lawyerQing.$refs.lawyerApply.open()
				}
			},
		confirmEntrustOk() {
			this.$refs.popupEntrustOk.close();
			this.$refs.popupReason.open();
		},
		async confirmReason() {
		  if(!this.reason){
        uni.showToast({
          title:'请填写解除理由',
          icon:'none',
          duration:1000
        })
        return;
      }
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token'),
				reason: this.reason
			};
			let res = await this.$api('index.lawyer_remove', formData);
			if (res.code == 1) {
        this.$refs.popupRemoveEntrustReason.close();
				this.init();
			}
		},
		async sureRemoveEntrust(status, pop) {
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token'),
				status: status
			};
			let res = await this.$api('index.lawyer_sure_remove', formData);
			if (res.code == 1) {
				if (pop == 'popupSureRemoveEntrust') {
					this.closePop('popupSureRemoveEntrust');
					this.init();
				} else if (pop == 'popupNoSureRemoveEntrust') {
					this.closePop('popupNoSureRemoveEntrust');
					this.init();
				}
			}
		},
		removeEntrust() {
			if (this.info.order.pend_text.length > 0) {
				this.$refs.popupRemoveEntrust.open();
			} else {
				this.$refs.popupRemoveEntrustReason.open();
			}
		},
		async confirmServiceOk() {
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('index.lawyer_sure', formData);
			if (res.code == 1) {
				this.$refs.popupServiceOk.close();
				this.init();
			}
		},
		async sureServiceOk(status, pop) {
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token'),
				status: status
			};
			let res = await this.$api('index.lawyer_sure_over', formData);
			if (res.code == 1) {
				if (pop == 'popupSureServiceOk') {
					this.closePop('popupSureServiceOk');
					this.init();
				} else if (pop == 'popupNoSureServiceOk') {
					this.closePop('popupNoSureServiceOk');
					this.init();
				}
			}
		},
		// 第一部分我要收款
		async confirmOneWantPay() {
			if (!this.onePrice || this.onePrice < 0.01) {
				uni.showToast({
					title: '请输入正确的金额',
					icon: 'none'
				});
				return false;
			}
			if (!this.oneReason) {
				uni.showToast({
					title: '请输入请款事由',
					icon: 'none'
				});
				return false;
			}
			// this.$refs.popupOneWantPay.close();
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token'),
				type: 2,
				price: this.onePrice,
				reason: this.oneReason
			};
			let res = await this.$api('index.lawyer_collect', formData);
			if (res.code == 1) {
			  this.$refs.popupOneWantPay.close();
				uni.showToast({
					title: res.msg,
					icon: 'none'
				});

				this.init();
			}
		},
		// 委托人取消申请服务完成，服务解除
		async cancleApplyService() {
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let url = '';
			// 律师点服务完成
			if (this.info.order.status == 4) {
				url = 'index.lawyer_cancel';
			}
			// 律师点服务解除
			else if (this.info.order.status == 11) {
				url = 'index.lawyer_cancel_remove';
			}
			let res = await this.$api(url, formData);
			if (res.code == 1) {
				uni.showToast({
					title: res.msg,
					icon: 'none'
				});
				this.init();
			}
		},
		timeup() {
			// this.init();
      this.jump('/pages/lawyer/user/service-end', { order_id: this.order_id })
		},
		//选择 更换律师理由
		cause(e){
			if(e==0){
				this.causeOne=!this.causeOne
				this.causeThree=false
				this.causeTwo=false
			}else if(e==1){
				this.causeTwo=!this.causeTwo
				this.causeThree=false
				this.causeOne=false
			}else{
				this.causeThree=!this.causeThree
				this.causeOne=false
				this.causeTwo=false
			}

			if(this.causeOne || this.causeTwo || this.causeThree){
				this.causeValue = true
			}else{
				this.causeValue = false
			}
		},
		//律师退回委托人申请更换律师
		async lawBack(){
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('index.backchange', formData);
			if (res.code == 1) {
				this.init();
			}
		},
		//律师同意委托人申请更换律师
		async lawAgree(){
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('index.lawyersurechange', formData);
			if (res.code == 1) {
				//this.init();
				this.replace('/pages/lawyer/user/order-cancel', {
					order_id: this.order_id
				});
			}
		},
		//换个律师
		async checkLaws() {
			var type='';
			if(this.causeOne==true) type=1;
			if(this.causeTwo==true) type=2;
			if(this.causeThree==true) type=3;
			if(type==''){
				uni.showToast({
					title:'请选择更换理由',
					icon:'none',
					duration:1000
				})
				return;
			}
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token'),
				type:type
			};
			if(type==3) formData.change_reason=this.causeThreeTxt
			let res = await this.$api('index.lawyerchange', formData);
			if (res.code == 1) {
				this.$refs.popupCheckLaw.close();
				this.init();
			}
		},
		//取消更换律师
		async cancelLaws(){
			let formData = {
				id: this.order_id,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('index.cancellawyerchange', formData);
			if (res.code == 1) {
				this.init();
			}
		}
	}
};
</script>

<style lang="scss">
.content {
	padding-bottom: 30rpx;
}
.ok-box {
	padding: 0;
}
.service-list {
	padding-top: 20rpx;
	margin-bottom: -10px;
}
//下半部分圆角矩形
.service-item {
	border-radius: 50rpx;
}

//更换律师
.check-back{
	background-color: #FFFFFF;
	padding: 30rpx;
	border-radius: 20rpx;
	width: 600rpx;
}
.check-title{
	font-size: 34rpx;
	font-weight: bold;
}
.close-img{
	width: 30rpx;
	height: 30rpx;
}
.list-item{
	display: flex;
	align-items: center;
	// margin-left: 20rpx;
	margin-top: 30rpx;
	width: 100%;
}
.btn{
	width: 330rpx;
	height: 60rpx;
	line-height: 60rpx;
	background-color: #FFC801;
	color: #FFFFFF;
	text-align: center;
	border-radius: 50rpx;
	margin: 0 auto;
	margin-top: 30rpx;
	margin-bottom: 20rpx;
}
.dis-btn{
	width: 330rpx;
	height: 60rpx;
	line-height: 60rpx;
	background-color: #f4f4f5;
	color: #bcbec2;
	text-align: center;
	border-radius: 50rpx;
	margin: 0 auto;
	margin-top: 30rpx;
	margin-bottom: 20rpx;
}
.od-item{
  display: flex;
  align-items: flex-start;
}
</style>
